package com.edu.exam.enums.examination.paper;

/**
 * 考号学生匹配状态枚举
 *
 * @author System
 * @version 1.0.0
 */
public enum ExamNumberStudentMatchStatus {
    MATCHED("MATCHED", "已匹配"),
    UNMATCHED("UNMATCHED", "未匹配"),
    MULTIPLE_MATCHES("MULTIPLE_MATCHES", "多个匹配"),
    AMBIGUOUS("AMBIGUOUS", "模糊匹配"),
    NOT_FOUND("NOT_FOUND", "未找到"),
    PENDING("PENDING", "待匹配"),
    EXCLUDED("EXCLUDED", "已排除"),
    MANUAL_REQUIRED("MANUAL_REQUIRED", "需人工处理"),
    TEMPORARY("TEMPORARY", "临时匹配"),
    INVALID_STUDENT("INVALID_STUDENT", "无效学生");

    private final String code;
    private final String description;

    ExamNumberStudentMatchStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static ExamNumberStudentMatchStatus fromCode(String code) {
        for (ExamNumberStudentMatchStatus status : ExamNumberStudentMatchStatus.values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown exam number student match status code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}
